package ai;
public class EqualDistance
{
	public static void display(int [] ary)
	{
		for(int i = 0; i < ary.length; i++)
		{
			System.out.println(ary[i]);
		}
	}
	
	public static int [] getEqualDistacePoint(int [] ary)
	{
		int [] result = new int[ary.length];
		for(int i = 0; i < (ary.length - 1); i++)
		{
			int subValue = ary[i + 1] - ary[i];
			if((subValue > 55) && (subValue < 65))
			{
				result[i] = ary[i];
				result[i + 1] = ary[i + 1];
			}
		}
		int num = 0;
		for(int i = 0; i < result.length; i++)
		{
			if(result[i] != 0)
			{
				num++;
			}
		}
		int [] res = new int[num];
		if(num != 7)
		{
			System.out.println("识别边界矩阵发生错误");
		}
		num = 0;
		for(int i = 0; i < result.length; i++)
		{
			if(result[i] != 0)
			{
				res[num++] = result[i];
			}
		}
		return res;
	}
	
	public static void main(String [] args)
	{
		int [] testAry = {373, 374, 375, 376, 377, 378, 440, 500, 560, 620, 680, 744 };
		int [] testAry1 = {167, 168, 169, 233, 293, 353, 413, 473, 536, 743, 744, 745, 747, 762, 763, 764, 765, 766 };
		int [] testAry2 = {135, 136, 137, 138, 139, 140, 142, 143, 144, 145, 145, 147, 209, 269, 329, 389, 449, 511, 513, 514, 515, 516, 517, 518, 520, 521, 522, 523 };
		int [] testAry3 = {92, 93, 94, 95, 96, 159, 219, 279, 332, 333, 339, 399, 461, 462, 575, 578, 579, 580, 582, 583, 584, 585, 586, 587, 589, 590, 581, 582, 593, 594, 596,
				597, 598 };
		int [] correctAry = EqualDistance.getEqualDistacePoint(testAry3);
		EqualDistance.display(correctAry);
	}
}
